/*
 * Filename:    WarnExamineResultController.java
 * Copyright:   2014 中国平安保险（集团）股份有限公司 版权所有
 * Company:     平安科技养老险及健康险系统开发部
 * Create at:   2014年11月13日
 */
package com.paic.mhis.hcpms.warning.web.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.paic.mhis.hcpms.warning.biz.service.WarningAuditResultService;
import com.paic.mhis.hcpms.warning.biz.service.WarningExamineResultService;
import com.paic.mhis.hcpms.warning.dto.WarningAuditResultDTO;
import com.paic.mhis.hcpms.warning.dto.WarningResultAuditDTO;
import com.paic.pafa.appclient.annotation.BizServicesProxy;

@Controller
@RequestMapping("/warnExamineResult/")
public class WarnExamineResultController {
	@BizServicesProxy
	private WarningAuditResultService warnAuditResultService;
	@BizServicesProxy
	private WarningExamineResultService warnExamineResultService;

	@RequestMapping("warnExamineResult.do")
	@ResponseBody
	public Map<String, Object> warnExamineResult(HttpServletRequest request) {
		Map<String, Object> map = new HashMap<String, Object>();
		Map<String, Object> paramMap = new HashMap<String, Object>();
		String warnNo = request.getParameter("warnNo");
		paramMap.put("warnno", StringUtils.isEmpty(warnNo) ? null : warnNo);
		List<WarningAuditResultDTO> auditResultList = warnAuditResultService.getAuditResultData(paramMap);
		List<WarningResultAuditDTO> examineResultList = warnExamineResultService.getExamineResultData(paramMap);
		if (auditResultList.size() > 0) {
			WarningAuditResultDTO auditResult = auditResultList.get(0);
			map.put("codedesc", auditResult.getCodeDesc());
			map.put("sumamount", auditResult.getSumAmount());
			map.put("point", auditResult.getPoint());
		}
		if (examineResultList.size() > 0) {
			WarningResultAuditDTO examineResult = examineResultList.get(0);
			map.put("examineCodedesc", examineResult.getAuditResult());
			map.put("examineSumamount", examineResult.getSumAmount());
			map.put("auditOpinion", examineResult.getAuditOpinion());
			map.put("remark", examineResult.getRemark());
		}
		return map;
	}

}
